rank.dcov.test = function(X,Y){
       X = as.matrix(X)
       Y = as.matrix(Y)
       U = V = NULL
       for(i in 1:ncol(X)){
               KCDF = kcdf(X[,i])
               U = cbind(U, KCDF(X[,i]))
       }
       for(i in 1:ncol(Y)){
               KCDF = kcdf(Y[,i])
               V = cbind(V, KCDF(Y[,i]))
       }
return(dcov.test(U,V));
}